package com.ex.mzwqz.activity;

import android.support.v4.app.Fragment;
import android.widget.RadioGroup;

import com.ex.mzwqz.R;
import com.ex.mzwqz.adapter.FragmentTabAdapter;
import com.ex.mzwqz.fragment.InformationFragment;
import com.ex.mzwqz.fragment.ManagerFragment;
import com.ex.mzwqz.fragment.MineFragment;
import com.ex.mzwqz.fragment.StatisticsFragment;
import com.ex.mzwqz.util.Constants;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends BaseActivity {

    //主界面四个面板
    private List<Fragment> fragments;
    //主界面面板容器
    public FragmentTabAdapter fragmentTabAdapter;
    //底部四个按钮
    public RadioGroup rgMenus;

    private int userType;


    @Override
    protected int setContentViewResId() {
        return R.layout.activity_main;
    }

    @Override
    protected void initView() {
        userType = getIntent().getIntExtra(Constants.REQUEST_TYPE_USER_TYPE,Constants.SYS_USER_TYPE_MZW);
        rgMenus = (RadioGroup) findViewById(R.id.widget_footer_tabs);
        fragments = new ArrayList<Fragment>();
        fragments.add(new InformationFragment());
        if(userType == Constants.SYS_USER_TYPE_MZW) {
            fragments.add(new ManagerFragment());
            fragments.add(new StatisticsFragment());
        }else {
            rgMenus.removeViews(1,2);
        }

        fragments.add(new MineFragment());
        fragmentTabAdapter = new FragmentTabAdapter(this, fragments,
                R.id.view_main_real_tab_content, rgMenus);
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initEvent() {

    }
}
